package com.nxn.dinner.model;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.nxn.core.model.IdEntity;

@Entity
@Table(name = "t_order_list")
public class OrderList extends IdEntity {

	private double price;
	private int count;
	private DeliveryOrder deliveryOrder;
	private long dishId;
	private Dish dish;
	
	@Column(name = "price")
	public double getPrice() {
		return price;
	}
	@Column(name = "count")
	public int getCount() {
		return count;
	}
	@ManyToOne(cascade={CascadeType.MERGE})
	public DeliveryOrder getDeliveryOrder() {
		return deliveryOrder;
	}
	@Column(name = "dish_id", insertable = true, updatable = false)
	public long getDishId() {
		return dishId;
	}
	@ManyToOne()
	@JoinColumn(name="dish_id", nullable = false, insertable = false, updatable = false)
	public Dish getDish() {
		return dish;
	}
	
	public void setPrice(double price) {
		this.price = price;
	}
	public void setCount(int count) {
		this.count = count;
	}
	public void setDeliveryOrder(DeliveryOrder deliveryOrder) {
		this.deliveryOrder = deliveryOrder;
	}
	public void setDish(Dish dish) {
		this.dish = dish;
	}
	public void setDishId(long dishId) {
		this.dishId = dishId;
	}
}
